package com.tentinet.flashviewproject;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.gc.flashview.MZFlashView;
import com.gc.flashview.listener.OnItemClickListener;

import java.util.ArrayList;

public class FlashViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_flash_view);

        ArrayList<String> imageUrls = new ArrayList<>();

        MZFlashView flashView = (MZFlashView) findViewById(R.id.activity_flash_view);
//        flashView.initImageLoadConfig(this);
//        flashView.adjustScreen(flashView , 0.0f);
//        imageUrls=new ArrayList<String>();
        flashView.setAuto(false);
//        flashView.setMutiRatio(0.8f);
//        flashView.setPageMargin(-110);
        imageUrls.add("http://img3.iqilu.com/data/attachment/forum/201308/21/192654ai88zf6zaa60zddo.jpg");
        imageUrls.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3599702497,2623245930&fm=27&gp=0.jpg");
        imageUrls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1532014468617&di=2a8841525c32022678575fa5e9105ff3&imgtype=0&src=http%3A%2F%2Fimg9.ph.126.net%2FCYzj-Dx1Se60FB0qmras9A%3D%3D%2F6597355639679993739.jpg");
        imageUrls.add("http://img3.iqilu.com/data/attachment/forum/201308/21/192654ai88zf6zaa60zddo.jpg");
        imageUrls.add("https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3599702497,2623245930&fm=27&gp=0.jpg");
        imageUrls.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1532014468617&di=2a8841525c32022678575fa5e9105ff3&imgtype=0&src=http%3A%2F%2Fimg9.ph.126.net%2FCYzj-Dx1Se60FB0qmras9A%3D%3D%2F6597355639679993739.jpg");


        flashView.setImageUris(imageUrls);
        flashView.setEffect(MZFlashView.Effect.ScaleTransformer);
        flashView.setRatio(0.8f);
//        flashView.setMutiRatio(0.8f);
//        flashView.setScale(true);
        //flashView.setEffect(EffectConstants.CUBE_EFFECT);//更改图片切换的动画效果
        flashView.setLoop(false);
        flashView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                Toast.makeText(FlashViewActivity.this, "position:" + position, Toast.LENGTH_SHORT).show();
            }
        });
    }

}
